#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2023/7/7 19:26
# @Author : 闫峰
# @File    : erp_get_token.py
from common.baserequest import Base_request




def get_token_by_erp(orderSourceType, orderSourceId):
    br = Base_request()
    user = "irobotbox"
    pwd = "i1r5o8Botbox"
    url = "http://api-erp.zhcxkj.com/erp/system/ordersource/certificate/refresh"
    data = {
        "language": "zh_CN",
        "input": {
            "customerId": 1,
            "orderSourceType": orderSourceType,
            "orderSourceId": orderSourceId
        }
    }
    res = br.post_auth(url=url, data=data, user=user, pwd=pwd)
    return res.get("data").get("merchantToken")


if __name__ == '__main__':
    print(get_token_by_erp(45, 5496))
